<?php
namespace app\services;

use app\models\Admin;

class AdminService {
    public static function loginChecked($username, $password) {
        $adminInfo = Admin::getInfo(['username' => $username]);
        if(!$adminInfo) {
            throwError('账号或密码不正确');
        }
        if($adminInfo['password'] != md5($password. $adminInfo['sign'])) {
            throwError('账号或密码不正确');
        }
        return $adminInfo['id'];
    }
}